/***********************************************************************************
**  
* @copyright (c) 2013-2100, ChengDu Westone Technology Co., LTD. All Right Reserved.
*
************************************************************************************/
/**
* @file	    duye_decoder.h
* @version     
* @brief      
* @author   
* @date	    2013-03-14
* @note 
*
*  1. 2017-03-14 yanglh Created this file
* 
*/
#pragma once

#include <string>
#include <duye_type.h>

namespace duye {

/**
 * @brief charset function
 * @note
 */
class Charset
{
public:
	enum {
		MATRIX_SIZE = 256
	};

	typedef struct tag_Decode {  
		uint8* buffer;
		uint8 map[MATRIX_SIZE][MATRIX_SIZE];
	} Decode;

public:
	static bool isUTF8(const uint8* buffer);
	static bool isGBK(const uint8* buffer, int32 bufferLen);

	static void initDecode(Decode& decode);
	static int32 decode(const Decode& decode, uint8* buffer, int32 bufferLen);
};

}
